--明置
local public = fk.CreateSkill {
    name = "mcdh_public"
}

public:addEffect('visibility',{
    global = true,
    card_visible = function(self, player, card)
        if Fk:currentRoom():getCardArea(card) == Card.PlayerHand and card:getMark("@@mcdh_overt_card") == 1 then
            return true
        end
    end
})

public:addEffect(fk.AfterCardsMove,
    {
    global = true,
    can_refresh = function (self, event, target, player, data)
        --按理来说有移动必定会暗置
        for _, move in ipairs(data) do
            if move.from == player.id then
                 for _, info in ipairs(move.moveInfo) do
                     if Fk:getCardById(info.cardId):getMark("@@mcdh_overt_card") > 0 then
                         return true
                    end
                end
            end
        end
    end,
    on_refresh =function (self, event, target, player, data)
        local room = player.room
        --储存明置牌信息
        local overt_cards = {}
        for _, move in ipairs(data) do
            if move.from == player.id then
                for _, info in ipairs(move.moveInfo) do
                    if Fk:getCardById(info.cardId):getMark("@@mcdh_overt_card") > 0 then
                        room:setCardMark(Fk:getCardById(info.cardId),"@@mcdh_overt_card",0)
                        table.insertIfNeed(overt_cards,info.cardId)
                    end
                end
            end
        end
        data.extra_data = data.extra_data or {}
        data.extra_data.overt_cards = data.extra_data.overt_cards or {}
        table.insertTableIfNeed(data.extra_data.overt_cards,overt_cards)
    end
})


return public